<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--在DOM元素上绑定onclick、onmouseover、onmouseout、onmousedown、onmouseup、ondblclick、onkeydown、onkeypress、onkeyup等。-->
<div onclick="hello()">我是一个div</div>
<script>
    function hello() {
        alert("hello world!");
    }
</script>
</body>
</html>